home *** CD-ROM | disk | FTP | other *** search
/ Aminet 34 / Aminet 34 (2000)(Schatztruhe)[!][Dec 1999].iso / Aminet / dev / lang / Python152_Src.lha / Python152_Source / Embed / EMBED_Readme.txt < prev    next >
Encoding:
Text File  |  1999-10-24  |  1.9 KB  |  63 lines

  1.  
  2. Embedding AmigaPython in your own programs
  3. ------------------------------------------
  4.  
  5. This directory shows how to embed the AmigaPython interpreter in your own
  6. application.  The file test.c shows you all that is needed in your C code.
  7.  
  8. To compile it, you'll have to assign PythonSrc:  to where your Python
  9. source tree is.
  10.  
  11. Note that AmigaPython's original main.o file has been replaced by a much
  12. smaller version:  AmigaPythonEmbed.c, which contains all necessary
  13. AmigaPython init and exit code.  It exports one function which you should
  14. call even before Py_Initialize (see the code):
  15.  
  16.     void InitAmigaPython(int argc, char **argv)
  17.  
  18. Pass the argc and argv parameters from your main() to this function.
  19. Currently, only the executable's name is used from this, no command line
  20. parameters are parsed.  So you can't use the Python command line parameters
  21. with your own program (usually this is no problem because obviously you
  22. want to have your own command line).
  23.  
  24. When obscure problems occur, have a look at the AmigaPythonEmbed.c file.
  25. Perhaps some things happen here which are unexpected or incompatible with
  26. your own code.
  27.  
  28.  
  29. See the test.c code and the SMAKEFILE for details.
  30.  
  31.  
  32.  
  33. Overview of the Python object/library files you must link with:
  34.  
  35. AmigaPythonEmbed.o
  36. Modules/getbuildinfo.o
  37. Modules/Modules.lib
  38. Parser/Parser.lib
  39. Python/Python.lib
  40. Objects/Objects.lib
  41. Amiga/amigapythonamitcp.lib
  42.  
  43. lib:scm881nb.lib
  44. lib:scnb.lib
  45.  
  46. (in this order). (Since 1.5.2, you'll need to compile with DATA=FARONLY,
  47. because the near data section is too large for DATA=NEAR).
  48.  
  49. SCOPTIONS are identical to the SCOPTIONS in the Python source tree, except
  50. for the path to the GST and the Include/ directory.
  51.  
  52.  
  53. You can override Python's $VER version string by declaring one of your own.
  54. See the code.
  55.  
  56.  
  57. Problems:  none.  The only problem I'm aware of is that the resulting
  58. executable is 400K+ minimum...
  59.  
  60.  
  61. Irmen de Jong
  62. irmen@bigfoot.com
  63.